*tagline
       <a href="{url}" target="_blank" class="cn_tag_item{tag:selected| cn_tag_selected}"><button type="button" class="btn btn-default btn-xs">{tag}</button></a>{comma| }

*print
   <html>
       <head>
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       </head>
       <body bgcolor="#ffffff" text="#000000" onload="window.print()">
          <strong>{title} @ <small>{date}</small></strong>
          <hr/>{full-story}<hr/>
          <small>News powered by CuteNews - https://cutephp.com</small>
       </body>
   </html>

I apologize for sending everything not in one message.
If the code contains links, you can not send everything in one. Restriction on the forum.

I hope my code and tips do not stay in the shadows. I will be happy if they are useful.

Below is an improved version of the bootstrap templates. Including navigation and all other templates.

#bootstrap
*active
   <div class="container">
       <div class="panel panel-default">
           <div class="panel-heading "  style='padding:5px;'>
               <div class="row">
                     <div class="col-xs-12 col-sm-3 col-md-2" style='padding:0px 5px;'>
                          <div class="col-xs-2 col-sm-4" style='padding:0px 5px;'>{avatar}</div>
                          <div class="col-xs-10 col-sm-8 text-center" style='padding:0px 5px;'>{date}<br />
                          [ {author} ]
                          </div>
                     </div> 
                     <div class="col-xs-12 col-sm-8 col-md-10 text-left" style='padding:5px;'>
                          <span class="h3">[link]{title}[/link]</span>
                     </div>
               </div>
           </div>
           
           <div class="panel-body">
                 {short-story}
           </div>
           
             <div class="panel-footer">
                <div class="row">
                      <div class="pull-left"  style="padding:2px;">
                          [full-link target=_blank]<button type="button" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-eye-open"> </span> Read more </button>[/full-link]
                          [com-link]<button type="button" class="btn btn-success btn-xs"><span class="glyphicon glyphicon-education"> </span> comments: {comments-num}</button>[/com-link]
                          [print]<button type="button" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-print"> </span> print</button>[/print]
                      </div>
                    <div class="pull-left"  style="padding:2px;">{twitter}</div>
                    <div class="pull-left"  style="padding:2px;">{gplus}</div>
                     <div class="pull-left"  style="padding:2px;">{fb-like}</div>
           
                </div>  
               <div class="row">
                   <div class="col-xs-12"><strong>{tagline}</strong></div>
                   </div>
               </div>

           </div>
       </div>
   
*full

<div class="container">
       <div class="panel panel-default">
           <div class="panel-heading "  style='padding:5px;'>
               <div class="row">
                     <div class="col-xs-12 col-sm-3 col-md-2" style='padding:0px 5px;'>
                          <div class="col-xs-3 col-sm-5" style='padding:10px;'>{avatar}</div>
                          <div class="col-xs-9 col-sm-7 text-center" style='padding:0px 5px;'>{date}<br />
                              [ {author} ]<br />
                            [com-link]<button type="button" class="btn btn-success btn-xs"><span class="glyphicon glyphicon-education"> </span> comments: {comments-num}</button>[/com-link]
                          </div>
                     </div> 
                     <div class="col-xs-12 col-sm-8 col-md-10 text-left" style='padding:5px;'>
                          <span class="h3">[link]{title}[/link]</span>
                     </div>
               </div>
           </div>
           
           <div class="panel-body">
                 {full-story}
           </div>
           
             <div class="panel-footer">
                <div class="row">
                      <div class="pull-left"  style="padding:2px;">
                          [print]<button type="button" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-print"> </span> print</button>[/print]
                      </div>
                    <div class="pull-left"  style="padding:2px;">{twitter}</div>
                    <div class="pull-left"  style="padding:2px;">{gplus}</div>
                     <div class="pull-left"  style="padding:2px;">{fb-like}</div>
           
                </div>  
                   <div class="row">
                   <div class="col-xs-12 col-sm-12"><strong>{tagline}</strong></div>
                   </div>
                   </div>
                 <div class="row">
                       <div class="col-xs-12 col-sm-12">{fb-comments}</div>
                   </div>
           </div>
       </div>

*comment

   <div class="container">
       <div class="panel panel-default">
           <div class="panel-heading">[delete]%cbox[/delete] by <strong>{author}</strong> @ {date} [edited](<i>Edited: %edited</i>)[/edited] [edit][Edit comment][/edit]
           </div>
           <div class="panel-body">{comment}
           </div>
       </div>
   </div>


*form

   <div class="container">
       <div class="panel panel-default panel-footer col-xs-12 col-md-4 col-sm-6 "><br />
           {remember_me}<br />
           &ensp; {input_username} {input_email} {input_commentbox} {smilies}<br />
           <br>[captcha]{captcha}[/captcha]<br />
           [submit]Add comment[/submit]<br />
           &ensp;
       </div>
   </div>

*prev_next

    <div class="text-center">   
        [prev-link]<button type="button" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-triangle-left"> </span> Previous page</button>[/prev-link]
        <span class="h4"><strong>{pages}</strong></span> 
        [next-link]<button type="button" class="btn btn-primary btn-xs"> Next page <span class="glyphicon glyphicon-triangle-right"></span> </button>[/next-link]
    </div>


*comments_prev_next
   
     <div class="text-center">   
        [prev-link]<button type="button" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-triangle-left"> </span> Previous page</button>[/prev-link]
        <span class="h4"><strong>{pages}</strong></span> 
        [next-link]<button type="button" class="btn btn-primary btn-xs"> Next page <span class="glyphicon glyphicon-triangle-right"></span> </button>[/next-link]
    </div>


*search

   <div class="container">
       <div class="panel panel-default panel-footer col-xs-12 col-md-4 col-sm-6 "><br />
            <form action="{php_self}" method="GET" class="form cn_search_form">
                 <div>{search_basic} Author: {author} {in_archives} In archives</div>
                 <div>{select=year:from} {select=mon:from} {select=day:from} &ndash; {select=year:to} {select=mon:to} {select=day:to}</div>
                 <div>[submit]Search[/submit]</div>
            </form>
         </div>
     </div>


 

Good afternoon. I saw that my thoughts and amendments, which I indicated in this message, were added to the release.
However, I noticed that some of my suggestions were added to the release as is.
In this case, some parts of the code will not work or will not work correctly.
I apologize for not specifying what is an assumption, and what is the correction of errors.
Today I want to clarify all the points, and also make some critical amendments.
All the code specified in this message can be used as is. This is not an assumption, but a fix option.



[fonts]
First of all, I want to note that there was a problem with loading fonts.
The "glyphicons" family placed not where they shuld.
For this time , they are located in (\libs\fonts\) with "fontawesome" fons.
And if "fontawesome" they are all right, then "glyphicons" not on worked place.
In version 2.1.0 - theme and skins has been changed and (bootstraps.css)
was moved to (\libs\css\themes\NAME).
But the font loading still refers to the (..\fonts\) directory from (bootstraps.css).
So it turns out that the "glyphicons" fonts should be located at (\libs\css\themes\fonts\).
There are two solutions.
1. The first is to move the fonts to worked place.
2. The second is rewrite all bootsrap.
From my point of view, that in the future not to get confused, it is easier to transfer fonts.
If you want to store all fonts in the same directory, then you should place all css
at the same level of relative distance to the fonts.


Now about code.

[/core/core.php] 1361
Corrected the output template for the function msg_info()
Corrected in connection with bootstrap

    echo '<section><div class="container"><div class="alert alert-warning">';
    echo '<strong>'.i18n('Warning!').' </strong> '.i18n($title).' <a href="'.$go_back.'" class="btn btn-warning btn-xs">OK</a>';
    echo '</div></div></section>'; 


[/core/core.php] 1429
When I described adding the Login button to the menu,
I did not want that you add the button itself,
but suggested that you shuld install the Hook in that place, to adapt the menu.
Without a separate wrapper with pre-processing the "?Login" value, such link is useless.
I wrote a small hook, similar to the hook for an authorized menu to fix this issue.
I checked it for work and I already wrote a plug-in for expanding the menu for my needs.
You may add it to release.

 // Make 'Top menu' for Guests
// Create a HOOK 'core/headermenu' and add One hided <li> menu.
// User may add new one with adding to the hook   ARRAY('#URL','TITLE');   

    $headermenu = hook('core/headermenu', array ('version' => array()));
    $menu_result = '';    
    foreach ($headermenu as $menu_key => $vol)
    {
        $menu_target = isset($vol[0]) ? $vol[0] : false;
        $menu_title = isset($vol[1]) ? $vol[1] : false;
        
        if (($menu_target) && ($menu_target[0] == '#')) {
            $menu_target = substr($menu_target, 1);
        } else {
            $menu_target = PHP_SELF;
        } 

        if ($menu_title) {
            $menu_result .= '<li><a class="nav-top-item" href="'.$menu_target.'">'.i18n($menu_title).'</a></li>';
        } else {
            $menu_result .= '<!--li><a class="nav-top-item" href="'.PHP_SELF.'">'.VERSION_NAME.'</a></li-->';
        }
    }    

    if (isset($_SESSION['user']))
    {
         $skin_header = preg_replace("/{menu}/", $skin_menu, $skin_header);
    }
    else 
    {
        $skin_header = preg_replace("/{menu}/", $menu_result, $skin_header);
    }


[/core/core.php] 3888
Now about redirection.
in the last message  i told about reassign PHP_SELF.
I gave an example of the code for the case with the Disabled overwrite module.
However, you should also add a reassignment in case if the module is enabled.
This is necessary for the correct formation of links in the case of using "cn_rewrite_url" value.
In my case, I wrote a wrapper for dashboard, search, news and plug-ins in one script.
So I redirect all requests to one script. And I have both variants of events
like working with redirection through "cn_rewrite_url"
and working with GET \ POST directly with the script.
Otherwise, if you do not reassign PHP_SELF, then 'show_news.php' script  may not get $PHP_SELF values.

        define('CN_REWRITE', $layout);                    
        if (isset($PHP_SELF)) 
        {
            define('PHP_SELF', $PHP_SELF);
        } 
        else 
        {
            define('PHP_SELF',  pathinfo(str_replace($basedir, '', $layout),PATHINFO_BASENAME));
        } 



[core/modules/dashboard.php] 415
The problem with overriding PHP_SELF and finding the cause of incorrect links
caused me to look at entire rewriting module.
And I found another inaccuracy in the code.
When apply rewrite settings and generating ".htaccess" file ,
the redirection is written to show_news.php script.
But in case we use a wrapper that we specify in
the field ('Real path to your layout file'),
is still written a standard value of show_news.php  to the ".htaccess" file.
This is because in the code there is no validation and no substitution with layout.
Below is the code correcting this critical error.
In my case, in the past and now, I was manual  rewrite in ".htaccess".
But I decided to deal with problem and  fix this bug.

             if ($URI == '/') 
            {
                $URI = '/show_news.php'; 
            }
            else 
            {
                if (!empty($post_cfg['rw_layout'])) 
                {
                    $URI .= '/'.basename($post_cfg['rw_layout']);
                } 
                else 
                {
                    $URI .= '/show_news.php';
                }
            }



[core/modules/dashboard.php] 560
Another small problem was checking the Avatar when updating user data.
In order to save the data, we had to constantly substitute the avatar.
And half the verification code, just did not work.
Here is fix.

         $correct = (empty($avatar_file['tmp_name']))? true : false;



[/core/news.php] 261
Now about Hook for redefining the link to the user's questionnaire.
In my last mesage, I gave an example of how I use links to access a custom module. And suggested to setting up Hook there.
But inserting a link to the code without my module was a mistake. Without custom module, that link will not work.
I bring the ready-made code for the link-formation of the Hook Overriding.
In the code below, for example, the hook value is specified to invoke the author search.
Of course, only if a search script is initiated on the page.
thus calling a hook, any custom module can form a flexible link.
By the way, search by authors is not working. I have not looked yet for a reason, but i will if ill got time.

     // user allow to show his email?
    if (isset($user['e-hide']) && $user['e-hide'])
    {
        if (db_user_by_name($e['u'])) {
        // Users can modify URL template for make custom querry
        //  by returning modified data from hook('news/authorurl')             
            $authorurl = hook('news/authorurl', '?dosearch=yes&user=');
            return '<a href="' . PHP_SELF . $authorurl . $e['u'] . '">' . $username . '</a>';
        } else {
            return $username;
        }
    }
    else
    {
        return cn_user_email_as_site($user['email'], $username);
    }

4

(5 replies, posted in Script Feedback and Suggestion)

I hope this helps a little.
Thanks for your work.

5

(5 replies, posted in Script Feedback and Suggestion)

A few edited templates for the bootstrap
default - Active news
default - Active news

 
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-12 col-sm-10"><span>[link]{title}[/link]</span></div>
                    <div class="col-xs-12 col-sm-2 text-right">[print][/print]</div>
                </div>
            </div>

            <div class="panel-body">{short-story}<br />
            [full-link target=_blank]<span class="glyphicon glyphicon-eye-open"></span><span>Read more... </span>[/full-link]</div>

            <div class="panel-footer" style="padding:2px;">
                <div class="row">
                    <div class="col-xs-12 col-sm-3">
                        <div class="row">
                            <div class="col-xs-3  text-right">{avatar}</div>

                            <div class="col-xs-9">[{author}] {date}<br />
                            [com-link] <span class="btn btn-default btn-xs"> Count of comments: {comments-num} </span> [/com-link]</div>
                        </div>
                    </div>

                    <div class="col-xs-8 col-sm-6 text-center">{tagline}</div>

                    <div class="col-xs-4 col-sm-3 text-left">
                        <div class="pull-left" style="min-height:30px">{twitter}</div>
                        <div class="pull-left" style="min-height:30px">{gplus}</div>
                        <div class="pull-left" style="min-height:30px">{fb-like}</div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-12">{fb-comments}</div>
                </div>
            </div>
        </div>
    </div>

deault - Full story

        <div class="container">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-xs-12 col-sm-3">
                            <div class="row">
                                <div class="col-xs-3  text-right">{avatar}
                                </div>
                                <div class="col-xs-9">[{author}] {date}<br />[com-link] <span class="btn btn-default btn-xs"> Count of comments: {comments-num} </span> [/com-link]
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-8 col-sm-6 text-center"><span class="lead">[link]{title}[/link]</span>
                        </div>
                        <div class="col-xs-4 col-sm-3 text-right">[print][/print]
                        </div>
                    </div>
                </div>

                <div class="panel-body">{full-story}
                </div>

                <div class="panel-footer">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8">{tagline}
                        </div>

                        <div class="col-xs-12 col-sm-4 text-left">
                            <div class="pull-left" style="min-height:30px">{twitter}
                            </div>

                            <div class="pull-left" style="min-height:30px">{gplus}
                            </div>

                            <div class="pull-left" style="min-height:30px">{fb-like}
                            </div>
                        </div>
                    </div>

                    <div class="row">
                       <div class="col-xs-12 col-sm-12">{fb-comments}
                       </div>
                    </div>
                </div>
            </div>
        </div> 

default - coment

        <div class="container">
            <div class="panel panel-default">
                <div class="panel-heading">[delete]%cbox[/delete] by <strong>{author}</strong> @ {date} [edited](<i>Edited: %edited</i>)[/edited] [edit][Edit comment][/edit]
                </div>

                <div class="panel-body">{comment}
                </div>
            </div>
        </div> 

default - add coment form

 
        <div class="container">
            <div class="panel panel-default panel-footer col-xs-12 col-md-4 col-sm-6 "><br />
                {remember_me}<br />
                &ensp; {input_username} {input_email} {input_commentbox} {smilies}<br />
                <br>[captcha]{captcha}[/captcha]<br />
                [submit]Add comment[/submit]<br />
                &ensp;
            </div>
        </div>

6

(5 replies, posted in Script Feedback and Suggestion)

[/core/includes/comments.php]
Line 168
Added a bootstrap class for the delete comment button.
but I still think that the style should be set in skins

    echo '<div id="del_btn" class="cn_comment_submit" style="visibility:hidden;"><input class="btn btn-default btn-danger" type="submit" id="btn_delete" value="Delete comments"/></div>'; 


Line 195
Added a bootstrap class for form

     echo '<form class="form-signin" role="form" name="comment_frm" action="'.$comment_url.'" method="POST"/>';

[/core/modules/add_news.php]
Line 10
Fixed links in the breadcrumbs, there was an index.php value

    
    cn_bc_add('Dashboard', PHP_SELF.'?mod=main');
    cn_bc_add('News listing', PHP_SELF.'?mod=editnews');
    cn_bc_add('Add new'); 


[/core/modules/edit_news.php]
Line 26 AND 284
Fixed links in the breadcrumbs, there was an index.php value
Also eliminated unnecessary calls localization func.

 
    cn_bc_add('Dashboard', PHP_SELF.'?mod=main');
    cn_bc_add('News listing', PHP_SELF.'?mod=editnews');


[/core/modules/dashboard.php]
Line 1238
corrected directory name of for USERS on the way in zip-class, otherwise all USERS data took off to NEWS directory.
before restoring the database, it is necessary to manually delete all the contents of the user's and news directory.
Otherwise, there will be problems with users registration, if this users was not overwritten by recovery.
It would be convenient to add pre-cleaning directories when unpacking.

$users = scan_dir(cn_path_construct(SERVDIR,'cdata','users'));
foreach ($users as $file)
  {
   $data = join('', file(cn_path_construct(SERVDIR,'cdata','users').$file));
   $zip->create_file($data, 'users'.DIRECTORY_SEPARATOR.$file);
  } 



Line 2198
Fixed URL direction after deleting words in localization. Replacement of index.php with $PHP_SELF

         if ($relocate_after) {
            cn_relocation(PHP_SELF.'?mod=main&opt=locale&lang='.$lang);
        }


[/skins/base/editnews/list.php]
Line
Added links to news in the news manager for users without the right to edit news.
It will be convenient if we enable browsing all news and archives for the commentators group.

 
    if (getoption('rw_engine'))
    {
          echo '<a href="'.PHP_SELF.cn_put_alias(intval($entry['id'])).'">'.cn_htmlspecialchars($entry['title']).'</a>';
     } else { 
          echo '<a href="'.PHP_SELF.'?id='.cn_put_alias(intval($entry['id'])).'">'.cn_htmlspecialchars($entry['title']).'</a>';
     }

Hi All.
A couple of years ago, I was met with this engine.
And once, I disassembled it on details for my needs.
Fix a lot of bugs and inaccuracies.
Transferred it to the bootstrap and make couple of modules.
And recently I cleaned up my archives
and came across a site on this engine.
I decided to see, is this  project live, and what's new on it.
It seems that the developers have done the same work, which I did in past for myself.

Here are a couple of bugs and suggestions for thinking.
for v2.1.0





[/core/core.php]
Line 1434
Added the LOGIN button in the navigation menu. added button localization
There need a hook to add the menu items for not logged user.

    $skin_header = preg_replace("/{menu}/", "<li><a class='nav' href='".PHP_SELF."/?login'>".i18n("LogIn")."</a></li><!--li><a href='".PHP_SELF."'>".VERSION_NAME."</a></li-->", $skin_header);

Line 1439
Was added a global variable $SiteTitle for the title of the site.
Set before inserting the news script

    
    global $SiteTitle;
    $skin_header = str_replace('{title}', ($header_text? $header_text.' / ' : '').$SiteTitle, $skin_header);

Line 3866
It is necessary to assign a PHP_SELF constant using a user override $PHP_SELF,
which would make the redirection work correctly.
Without this moment, it is not possible to realize all power of redirection.

    if (isset($PHP_SELF)) {
        define('PHP_SELF',   $PHP_SELF);
    } else {
        define('PHP_SELF',   $_SERVER["SCRIPT_NAME"]);
    }

Line 4049
Added Localization for breadcrumbs in Dashboards

      if ($kcount == $i) {
          $ls[] = '<span class="bcitem">' . i18n($item['name']) . '</span>';
      } else {
          $ls[] = '<span class="bcitem"><a href="' . $item['url'] . '">' . i18n($item['name']) . '</a></span>';
      }

[/core/news.php]
Line 94
removed the red button class for ReedMore.
CSS should be set in skins.

    if (isset($bb['target'])&&$bb['target']) $a_opts = 'target="'.cn_htmlspecialchars($bb['target']).'" ';//se agrego la clase class="btn btn-default" de boot strap

Line 256
Wrote the module of the user's questionnaire. Replaced the link of the (user's mail) to the Module.
Here Need to be a hook for the formation of the functions of clicking on the name (nickname).

 return '<a href="'.PHP_SELF.'?mod=main&opt=usersabout&user_name='.$e['u'].'">'.$username.'</a>';  



Line 672
Fixed URL direction. Replacement of index.php with PHP_SELF

  if (test('Cen'))
    {
        $URL = getoption('http_script_dir').'/'.PHP_SELF.'?mod=editnews&amp;action=editnews&amp;id='.intval($e['id']);
        return '<a '.$opts.'href="'.$URL.'">'.$t.'</a>';
    }


Line 889
Added </div> at the end of the capcha image. Without was broke the whole footer.

     $echo = '<div class="cn_comm_captcha"><a href="#" onclick="cn_get_id(\''.$ID.'\').src = \''.$cpath.'?r=\' + Math.random(); return false;"><img src="'.$cpath.'" alt="CAPTCHA, click to refresh" id="'.$ID.'"/></a></div>';


Line 743
Replacing the link of comments authors on user's module, or email if it was a guest's
Hook shuld be here.

         if (db_user_by_name($e['u'])) return '[<a href="'.PHP_SELF.'?mod=main&opt=usersabout&user_name='.$user['name'].'">'.$username.'</a>]';