Самозаверяющие сертификаты в Exchange Server 2007

16:13 Рубрика: Ацкий одмин

Цифровые сертификаты — это электронные файлы, которые используются аналогично паролям для подтверждения подлинности пользователя или компьютера. Кроме того, сертификаты применяются для создания канала с SSL-шифрованием, который используется для связи между сервером сMicrosoft Exchange и клиентским компьютером или устройством. Цифровой сертификат — это документ, который выпускается центром сертификации; он подтверждает подлинность держателя сертификата и позволяет шифровать передаваемые данные.

Далее

Отправка почты с консоли

22:58 Рубрика: Linux

SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to learn and use.

More

Выключение компьютера из консоли с привилегиями пользователя

11:46 Рубрика: Linux

/usr/lib/indicator-session/gtk-logout-helper --shutdown

Ребут:

/usr/lib/indicator-session/gtk-logout-helper --restart  

Логаут:

/usr/lib/indicator-session/gtk-logout-helper

(c)

Handling drupal_set_message for anonymous users

00:11 Рубрика: Drupal

A. I am facing this very specific problem, Any help would be appreciated.

Everything was working fine untill recently. Now I do not get the New Account Creation Notification on Screen that is displayed to the user. The email gets sent to the user email id but on the screen the user does not come to know that is registration is complete and successfull.

Same for the Forget Password section.

All other messages given by 'drupal_set_message' work. The problem is with these 2 specific messages.
1. New Account Creation Notification on Screen
2. Password Reset Notification on Screen

The only thing that has changed in recent times with the site is that I happened to upgrade the PHP on the server to PHP 5.1.6.

Does that cause any problem?

Please help.

Thanks.

------------------------------------
Q. Somehow the anonymous user was deleted from the database. So check to see if you have a uid of 0 still there. If it isn't there, put it back. That cleared up this issue for me. Here is the sql to do it. The question here is, where did that user go, how did it get deleted?

INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO users_roles (uid, rid) VALUES (0, 1);

I hope this helps someone avoid a long bug hunt.

---------------------------------------

Worked perfectly for us. A user delete-statement deleted to many users, in our case also the anonymous user.
But when we inserted the user with the insert-statement from above, the new anonymous user got inserted with the uid 6412 or so (because of the auto increment).

So we just changed the uid to 0, and everything worked like a charm.

Thanks a lot.

Далее

Sendmail-заглушка для Linux

08:36 Рубрика: Linux

Не так давно встала задача, установить заглушку для sendmail, дабы письма из PHP не отсылались на ложные адреса (при тестинге) или просто не возникала ошибка, а складывались аккуратно в папку. Аналогично тому, как это делает Денвер.
Далее…

Выполнить PHP-код на сайте

00:59 Рубрика: Drupal

Варианты

Выполнить код (сниппет) можно:

  • В блоке
  • В блоке Execute PHP модуля Devel
  • На странице
  • В отдельном файле



Далее »

Drupal + PHP - How To Auto-Truncate Content At The End Of A Word

00:40 Рубрика: Drupal

The problem:
Whilst working on an aggregation site recently I needed to find a way to truncate the length of aggregated posts so that they only showed the first 200 or so characters of the post. However, I also wanted the split point in the post to occur at the end of a whole word, as opposed to part way through a word, and add some visual indication that there was more still to read.

The solution:

More »

Text-shadow — эффект гравировки, вдавленности и тени от текста

15:17 Рубрика: jQuery

В сегодняшней статье я хочу раскрыть тему CSS-свойства text-shadow. Это свойство не является новым в CSS — оно появилось еще в CSS 2, но было реализовано не всеми браузерами.

Text-shadow чаще используется не для того, чтобы создать размытую тень за текстом, а для того, чтобы реализовать эффект гравировки или вдавленности текста. Если вы посмотрите на пример iPhone на jQuery в Safari или Opera > 9.5, то сможете увидеть эффект гравироки в заголовке айФона.

Это свойство любят использовать разные модные парни, но в большинстве случаев эти модные парни прибегают к помощи фотошопа, а не CSS. Сегодня я расскажу, кто эти модные парни и как им можно помочь.

Далее

---

19:13 Рубрика: Всячина

Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете.

Стив Макконнелл

Basic Next/Previous Navigation For Nodes

22:18 Рубрика: Drupal

When viewing a node, I wanted the ability to page through to the next and previous article.

  • Code is abstracted out into 2 different functions.
  • You can specify the text to be used for the generated links.
  • Uses l() instead of hardcoding directly generating the links using $nid. l() uses aliases if available and therefore generated links are consistent with the rest of the site.
  • Uses a few class attributes to generated links so they can be styled.

These 2 functions (plus maybe a lot of other similar functions) can be abstracted out into a module.

  1. Create a file called template.php in your theme's folder if it does not already exist, assuming that theme is PHPTemplate-based.
  2. Copy the 2 functions next_node() and previous_node() into template.php. Copy the functions along with their complete definitions i.e. the whole body not only the function names. Make sure the functions are withing <?php and ?> tags.
  3. Copy the code snippet to the place in node.tpl.php where you want the links to appear. These links should appear only when a node is view in its entirety so put them in a if($page!=0).

For themes using other engines you will have to read the appropriate documentation to know where to put the code.

<?php
   
/**
     * Enables theme developers to include a link to the node of the same type
     * that comes immediately after the the node being currently viewed.
     *
     * A node has to be published and promoted to the front page to
     * qualify as the 'next node'. Unpublished and nodes not promoted
     * to front page are not considered.  Access control is respected.
     *
     * Theme developers would normally use this in the template for a node.
     *   
     * @param $node
     *     node whose next node is to be found.
     * @param $next_node_text
     *   The text for the link that will be created. If no text is given
     *     then the title of the next node is used.
     * @param $prepend_text
     *     Text to be prepended to the created link. It is not a part of the link.
     * @param $append_text
     *     Text to be appended to the created link. It is not a part of the link.
     *
     */  
   
function next_node($node, $next_node_text=NULL, $prepend_text=NULL, $append_text=NULL)
    {  
       
$query = db_rewrite_sql("SELECT nid, title FROM {node} WHERE created > '%s' AND status=1 and promote=1 AND type='%s' ORDER BY created ASC LIMIT 1", "node", "nid");
       
       
$result = db_query($query, $node->created, $node->type);

      
$next_node = db_fetch_object($result);

        if(!
$next_node_text) // If next_node_text is not specified then use the next node's title as the text for the link.
       
{
           
$next_node_text = $next_node->title;      
        }
      
        if(
$next_node->nid!=NULL)
        {
            return
$prepend_text.l($next_node_text, 'node/'.$next_node->nid, array('title'=>'Go to the next post "'.$next_node_text.'"', 'class'=>'goto-previous-node')).$append_text;
        }
        else
// There is no next node for this node...
       
{
            return
NULL;
        }
    }

   
/**
     * Enables theme developers to include a link to the node of same type
     * that comes immediately before the the node being currently viewed.
     *
     * A node has to be published and promoted to the front page to
     * qualify as the 'previous node'. Unpublished and nodes not promoted
     * to front page are not considered.  Access control is respected.
     *
     * Theme developers would normally use this in the template for a node.
     *   
     * @param $node
     *     node whose next node is to be found.
     * @param $previous_node_text
     *   The text for the link that will be created. If no text is given
     *     then the title of the previous node is used.
     * @param $prepend_text
     *     Text to be prepended to the created link. It is not a part of the link.
     * @param $append_text
     *     Text to be appended to the created link. It is not a part of the link.
     *
     */
   
function previous_node($node, $previous_node_text=NULL, $prepend_text=NULL, $append_text=NULL)
    {  

       
$query = db_rewrite_sql("SELECT nid, title FROM {node} WHERE created < '%s' AND status=1 and promote=1 AND type='%s' ORDER BY created DESC LIMIT 1", "node", "nid");
       
       
$result = db_query($query, $node->created, $node->type);

      
$previous_node = db_fetch_object($result);

        if(!
$previous_node_text) // If previous_node_text is not specified then use the previous node's title as the text for the link.
       
{
           
$previous_node_text = $previous_node->title;      
        }
      
        if(
$previous_node->nid!=NULL)
        {
            return
$prepend_text.l($previous_node_text, 'node/'.$previous_node->nid, array('title'=>'Go to the previous post "'.$previous_node_text.'"', 'class'=>'goto-previous-node')).$append_text;
        }
        else
// This node does not have a previous node...
       
{
            return
NULL;
        }
    }
?>

Alternately you use this return statement:
            return $prepend_text.l($next_node_text, 'node/'.$next_node_nid, array('title'=>'Go to the next post "'.$next_node_text.'"', 'class'=>'goto-next-node')).$append_text;

I used the above code in my node.tpl.php just below the node body like this:

<?php
   
if($page!=0)
    {
       
$previous_node_link = previous_node($node, NULL, '&lt;&lt; ', NULL);
       
$next_node_link = next_node($node, NULL, NULL, ' &gt;&gt;');   
       
        print
'<div>';
        if(
$previous_node_link && $next_node_link)
        {
            print
$previous_node_link.' | '.$next_node_link;
        }
        else if(
$previous_node_link)
        {
            print
$previous_node_link;
        }
        else if(
$next_node_link)
        {
            print
$next_node_link;
        }
        print
'</div>';
    }
?>

update:

The above functions, though functional are huge resource hogs. Doing a node_load on every node until you find the correct taxonomy term has a huge performace impact. This can be overcome by with some simple sql joins. Here is an updated function. I've also combined the 2 functions into one.

<?php
function node_sibling($dir = 'next', $node, $next_node_text=NULL, $prepend_text=NULL, $append_text=NULL, $tid = FALSE){
  if(
$tid){
   
$query = 'SELECT n.nid, n.title FROM {node} n INNER JOIN {term_node} tn ON n.nid=tn.nid WHERE '
          
. 'n.nid ' . ($dir == 'previous' ? '<' : '>') . ' %d AND n.type = "%s" AND n.status=1 '
          
. 'AND tn.tid = %d ORDER BY n.nid ' . ($dir == 'previous' ? 'DESC' : 'ASC');
   
$result = db_query($query, $node->nid, $node->type, $tid);
  }else{
   
$query = 'SELECT n.nid, n.title FROM {node} n WHERE '
          
. 'n.nid ' . ($dir == 'previous' ? '<' : '>') . ' %d AND n.type = "%s" AND n.status=1 '
          
. 'ORDER BY n.nid ' . ($dir == 'previous' ? 'DESC' : 'ASC');
   
$result = db_query($query, $node->nid, $node->type);
  }
  if(
$row = db_fetch_object($result)){
   
$text = $next_node_text ? $next_node_text : $row->title;
    return
$prepend_text . l($text, 'node/'.$row->nid, array('rel' => $dir)) . $append_text;
  }else{
    return
NULL;
  }
}
?>

(c)

Далее