当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::add方法代码示例

本文整理汇总了PHP中Notification::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::add方法的具体用法?PHP Notification::add怎么用?PHP Notification::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 public function login()
 {
     RoutingEngine::setPage("runnDAILY Login", "PV__400");
     if (RoutingEngine::getInstance()->requirePermission("PV__300")) {
         Notification::add("You are already logged in.");
         Page::redirect("/");
     }
 }
开发者ID:byronwall,项目名称:runnDAILY,代码行数:8,代码来源:home.php

示例2: addNotice

 public function addNotice($replytouid, $logid, $info, $type = 'comment')
 {
     $data = array('uid' => $replytouid, 'content' => $info, 'new' => 1, 'type' => $type, 'cTime' => time(), 'from_id' => $logid, 'from_num' => 1);
     if (Notification::add($data)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:9,代码来源:T.php

示例3: action_elevation_add_packed

 public function action_elevation_add_packed()
 {
     if ($_FILES["packed_hdr"]) {
         move_uploaded_file($_FILES["packed_hdr"]["tmp_name"], SYSTEM_ROOT . "/elev_packed.hdr");
     }
     if ($_FILES["packed_flt"]) {
         move_uploaded_file($_FILES["packed_flt"]["tmp_name"], SYSTEM_ROOT . "/elev_packed.flt");
     }
     $region = array_safe($_POST, "region_name", "Elevation data");
     Elevation::addElevationToDatabase(SYSTEM_ROOT . "/elev_packed", 1, $region);
     unlink(SYSTEM_ROOT . "/elev_packed.hdr");
     unlink(SYSTEM_ROOT . "/elev_packed.flt");
     Notification::add("Elevation data has been added");
     Page::redirect("/admin/elevation");
 }
开发者ID:byronwall,项目名称:runnDAILY,代码行数:15,代码来源:admin.php

示例4: delete

 function delete()
 {
     //check permissions
     if (!isset($_POST["e_eid"])) {
         Notification::add("Could not delete the event.");
         Page::redirect("/events");
     }
     $event = new Event($_POST);
     if ($event->delete()) {
         Notification::add("Event was deleted.");
         Page::redirect("/events");
     }
     Notification::add("Error deleting.");
     Page::redirect("/events");
 }
开发者ID:byronwall,项目名称:runnDAILY,代码行数:15,代码来源:events.php

示例5: install

 /**
  * Install mreporting notifications.
  * 
  * @return array 'success' => true on success
  */
 static function install()
 {
     global $LANG, $DB;
     // Création du template de la notification
     $template = new NotificationTemplate();
     $found_template = $template->find("itemtype = 'PluginMreportingNotification'");
     if (count($found_template) == 0) {
         $template_id = $template->add(array('name' => $LANG['plugin_mreporting']['notification_name'], 'comment' => $LANG['plugin_mreporting']['notification_comment'], 'itemtype' => 'PluginMreportingNotification'));
         // Ajout d'une traduction (texte) en Français
         $translation = new NotificationTemplateTranslation();
         $translation->add(array('notificationtemplates_id' => $template_id, 'language' => '', 'subject' => $LANG['plugin_mreporting']['notification_subject'], 'content_text' => $LANG['plugin_mreporting']['notification_text'], 'content_html' => $LANG['plugin_mreporting']['notification_html']));
         // Création de la notification
         $notification = new Notification();
         $notification_id = $notification->add(array('name' => $LANG['plugin_mreporting']['notification_name'], 'comment' => $LANG['plugin_mreporting']['notification_comment'], 'entities_id' => 0, 'is_recursive' => 1, 'is_active' => 1, 'itemtype' => 'PluginMreportingNotification', 'notificationtemplates_id' => $template_id, 'event' => 'sendReporting', 'mode' => 'mail'));
     }
     $DB->query('INSERT INTO glpi_notificationtargets (items_id, type, notifications_id) 
            VALUES (1, 1, ' . $notification_id . ');');
     return array('success' => true);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:24,代码来源:notification.class.php

示例6: install

 public static function install()
 {
     $notifications = array('plugin_formcreator_form_created' => array('name' => __('A form has been created', 'formcreator'), 'subject' => __('Your request have been saved', 'formcreator'), 'content' => __('Hi,\\nYour request from GLPI have been successfully saved with number ##formcreator.request_id## and transmetted to the helpdesk team.\\nYou can see your answers onto the following link:\\n##formcreator.validation_link##', 'formcreator'), 'notified' => self::AUTHOR), 'plugin_formcreator_need_validation' => array('name' => __('A form need to be validate', 'formcreator'), 'subject' => __('A form from GLPI need to be validate', 'formcreator'), 'content' => __('Hi,\\nA form from GLPI need to be validate and you have been choosen as the validator.\\nYou can access it by clicking onto this link:\\n##formcreator.validation_link##', 'formcreator'), 'notified' => self::APPROVER), 'plugin_formcreator_refused' => array('name' => __('The form is refused', 'formcreator'), 'subject' => __('Your form have been refused by the validator', 'formcreator'), 'content' => __('Hi,\\nWe are sorry to inform you that your form have been refused by the validator for the reason below:\\n##formcreator.validation_comment##\\n\\nYou can still modify and resubmit it by clicking onto this link:\\n##formcreator.validation_link##', 'formcreator'), 'notified' => self::AUTHOR), 'plugin_formcreator_accepted' => array('name' => __('The form is accepted', 'formcreator'), 'subject' => __('Your form have been accepted by the validator', 'formcreator'), 'content' => __('Hi,\\nWe are pleased to inform you that your form have been accepted by the validator.\\nYour request will be considered soon.', 'formcreator'), 'notified' => self::AUTHOR), 'plugin_formcreator_deleted' => array('name' => __('The form is deleted', 'formcreator'), 'subject' => __('Your form have been deleted by an administrator', 'formcreator'), 'content' => __('Hi,\\nWe are sorry to inform you that your request cannot be considered and have been deleted by an administrator.', 'formcreator'), 'notified' => self::AUTHOR));
     // Create the notification template
     $notification = new Notification();
     $notification_target = new NotificationTarget();
     $template = new NotificationTemplate();
     $translation = new NotificationTemplateTranslation();
     foreach ($notifications as $event => $datas) {
         // Check if notification allready exists
         $exists = $notification->find("itemtype = 'PluginFormcreatorFormanswer' AND event = '{$event}'");
         // If it doesn't exists, create it
         if (count($exists) == 0) {
             $template_id = $template->add(array('name' => addslashes($datas['name']), 'comment' => '', 'itemtype' => 'PluginFormcreatorFormanswer'));
             // Add a default translation for the template
             $translation->add(array('notificationtemplates_id' => $template_id, 'language' => '', 'subject' => addslashes($datas['subject']), 'content_text' => addslashes($datas['content']), 'content_html' => '<p>' . str_replace('\\n', '<br />', $datas['content']) . '</p>'));
             // Create the notification
             $notification_id = $notification->add(array('name' => addslashes($datas['name']), 'comment' => '', 'entities_id' => 0, 'is_recursive' => 1, 'is_active' => 1, 'itemtype' => 'PluginFormcreatorFormanswer', 'notificationtemplates_id' => $template_id, 'event' => $event, 'mode' => 'mail'));
             // Add default notification targets
             $notification_target->add(array("items_id" => $datas['notified'], "type" => Notification::USER_TYPE, "notifications_id" => $notification_id));
         }
     }
 }
开发者ID:ChristopheG77,项目名称:formcreator,代码行数:23,代码来源:notificationtargetformanswer.class.php

示例7: merge

 public function merge($ids)
 {
     // get the first sequence
     $firstID = array_pop($ids);
     $sequence = LevelUp::find($firstID);
     // Check the sequences are the same
     foreach ($ids as $id) {
         $oldSeq = LevelUp::find($id);
         foreach ($oldSeq->data as $data) {
             $newData = $sequence->data->where('level', $data->level)->first();
             if ($newData) {
                 if ($newData->fish !== $data->fish || $newData->wood !== $data->wood || $newData->iron !== $data->iron || $newData->time !== $data->time) {
                     \Notification::add('warning', 'Sequences are different at level ' . $newData->level . '!');
                     return false;
                 }
             }
         }
     }
     foreach ($ids as $id) {
         // then reattach the other dragons to this sequence
         foreach ($oldSeq->dragons as $dragon) {
             $dragon->levelUp()->associate($sequence);
             $dragon->save();
         }
         // Copy data across or delete the data
         foreach ($oldSeq->data as $data) {
             $newData = $sequence->data->where('level', $data->level)->first();
             if (!$newData) {
                 $sequence->data()->save($data);
             } else {
                 $data->delete();
             }
         }
         // and delete the sequence
         $oldSeq->delete();
     }
 }
开发者ID:rickselby,项目名称:dragons-helper,代码行数:37,代码来源:LevelUpService.php

示例8: favorite

 public static function favorite($code, $type, $from = 'web', $uid = '')
 {
     if (!$code || !$type) {
         return array('status' => 0, 'msg' => '数据不全,请核实');
     }
     if (!in_array($type, array('post'))) {
         return array('status' => 0, 'msg' => '暂不允许的分类');
     }
     if (is_numeric($code)) {
         $id = $code;
     } else {
         $codeArr = Posts::decode($code);
         if ($codeArr['type'] != $type || !is_numeric($codeArr['id']) || $codeArr['id'] < 1) {
             $this->jsonOutPut(0, '您所查看的内容不存在');
         }
         $id = $codeArr['id'];
     }
     if (!$uid) {
         $uid = zmf::uid();
     }
     if ($uid) {
         if (zmf::actionLimit('favorite-' . $type, $id)) {
             return array('status' => 0, 'msg' => '操作太频繁,请稍后再试');
         }
     } else {
         //没有登录的访客点收藏时判断是否已收藏过
         if (zmf::actionLimit('favorite-' . $type, $id, 1, 86400, true)) {
             return array('status' => 1, 'msg' => '已点赞', 'state' => 1);
         }
         $uid = 0;
     }
     $postInfo = Posts::model()->findByPk($id);
     if (!$postInfo || $postInfo['status'] != Posts::STATUS_PASSED) {
         return array('status' => 0, 'msg' => '文章不存在');
     }
     $attr = array('uid' => $uid, 'logid' => $id, 'classify' => $type);
     $info = false;
     if ($uid) {
         $info = Favorites::model()->findByAttributes($attr);
     }
     if ($info) {
         if (Favorites::model()->deleteByPk($info['id'])) {
             if ($type == 'post') {
                 Posts::updateCount($id, 'Posts', -1, 'favorite');
             }
             return array('status' => 1, 'msg' => '取消点赞', 'state' => 3);
         } else {
             return array('status' => 0, 'msg' => '取消点赞失败', 'state' => 4);
         }
     } else {
         $attr['cTime'] = zmf::now();
         $model = new Favorites();
         $model->attributes = $attr;
         if ($model->save()) {
             if ($type == 'post') {
                 Posts::updateCount($id, 'Posts', 1, 'favorite');
             }
             //点赞后给对方发提醒
             $_noticedata = array('uid' => $postInfo['uid'], 'authorid' => $uid, 'content' => "您的文章【{$postInfo['title']}】有了新的赞", 'new' => 1, 'type' => 'favorite', 'cTime' => zmf::now(), 'from_id' => $model->id, 'from_num' => 1);
             Notification::add($_noticedata);
             return array('status' => 1, 'msg' => '点赞成功', 'state' => 1);
         } else {
             return array('status' => 0, 'msg' => '点赞失败', 'state' => 2);
         }
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:66,代码来源:Posts.php

示例9: addAllNotifications

 /**
  * Returns an Event specified by the provided proxy_id, content_type and record_id, as well
  * as a record_proxy_id in the case of some types of content. 
  * 
  * @param string $content_type
  * @param int $record_id
  * @param int $record_proxy_id
  * @return array
  */
 public static function addAllNotifications($content_type, $record_id, $record_proxy_id = 0, $proxy_id, $content_id)
 {
     global $db;
     $query = "SELECT * FROM `notification_users` \n\t\t\t\t\tWHERE `content_type` = " . $db->qstr($content_type) . "\n\t\t\t\t\tAND `notify_active` = 1\n\t\t\t\t\tAND `record_id` = " . $db->qstr($record_id) . ($record_proxy_id ? "\n\t\t\t\t\tAND `record_proxy_id` = " . $db->qstr($record_proxy_id) : "");
     $results = $db->getAll($query);
     if ($results) {
         require_once "Models/notifications/Notification.class.php";
         foreach ($results as $result) {
             if ($result["proxy_id"] != $proxy_id) {
                 $notification = Notification::add($result["nuser_id"], $proxy_id, $content_id);
             }
         }
     }
     return false;
 }
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:24,代码来源:NotificationUser.class.php

示例10: action_copy_view

 public function action_copy_view()
 {
     RoutingEngine::setPage("runnDAILY Routes", "PV__300");
     $route = new Route($_POST);
     if ($route->copy()) {
         Notification::add("Your route - {$route->name} - was copied.");
         Page::redirect("/routes/view/{$route->id}");
     }
     Notification::add("There was an error copying the route.  Try again.");
     Page::redirect("/routes/view/{$route->id}");
 }
开发者ID:byronwall,项目名称:runnDAILY,代码行数:11,代码来源:routes.php

示例11: afterCreate

 public function afterCreate($image)
 {
     Notification::add($image->id, 'Image');
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:4,代码来源:VIImage.php

示例12: install

    public static function install(Migration $migration)
    {
        global $DB;
        $migration->displayMessage("Migrate PluginOrderOrder notifications");
        $template = new NotificationTemplate();
        $templates_id = false;
        $query_id = "SELECT `id`\n                       FROM `glpi_notificationtemplates`\n                       WHERE `itemtype`='PluginOrderOrder'\n                       AND `name` = 'Order Validation'";
        $result = $DB->query($query_id) or die($DB->error());
        if ($DB->numrows($result) > 0) {
            $templates_id = $DB->result($result, 0, 'id');
        } else {
            $tmp = array('name' => 'Order Validation', 'itemtype' => 'PluginOrderOrder', 'date_mod' => $_SESSION['glpi_currenttime'], 'comment' => '', 'css' => '');
            $templates_id = $template->add($tmp);
        }
        if ($templates_id) {
            $translation = new NotificationTemplateTranslation();
            if (!countElementsInTable($translation->getTable(), "`notificationtemplates_id`='{$templates_id}'")) {
                $tmp['notificationtemplates_id'] = $templates_id;
                $tmp['language'] = '';
                $tmp['subject'] = '##lang.ordervalidation.title##';
                $tmp['content_text'] = '##lang.ordervalidation.url## : ##ordervalidation.url##
               ##lang.ordervalidation.entity## : ##ordervalidation.entity##
               ##IFordervalidation.name####lang.ordervalidation.name## : ##ordervalidation.name##
               ##ENDIFordervalidation.name##
               ##IFordervalidation.numorder####lang.ordervalidation.numorder## : ##ordervalidation.numorder##
               ##ENDIFordervalidation.numorder##
               ##IFordervalidation.orderdate####lang.ordervalidation.orderdate##  : ##ordervalidation.orderdate####ENDIFordervalidation.orderdate##
               ##IFordervalidation.state####lang.ordervalidation.state## : ##ordervalidation.state####ENDIFordervalidation.state##
               ##IFordervalidation.users####lang.ordervalidation.users## : ##ordervalidation.users####ENDIFordervalidation.users##

               ##IFordervalidation.comment####lang.ordervalidation.comment## : ##ordervalidation.comment####ENDIFordervalidation.comment##';
                $tmp['content_html'] = '&lt;p&gt;&lt;strong&gt;##lang.ordervalidation.url##&lt;/strong&gt; : ' . '&lt;a href=\\"##ordervalidation.url##\\"&gt;##ordervalidation.url##&lt;/a&gt;&lt;br /&gt;' . '&lt;br /&gt;&lt;strong&gt;##lang.ordervalidation.entity##&lt;/strong&gt; : ##ordervalidation.entity##&lt;br /&gt;' . ' ##IFordervalidation.name##&lt;strong&gt;##lang.ordervalidation.name##&lt;/strong&gt;' . ' : ##ordervalidation.name####ENDIFordervalidation.name##&lt;br /&gt;' . '##IFordervalidation.numorder##&lt;strong&gt;##lang.ordervalidation.numorder##&lt;/strong&gt;' . ' : ##ordervalidation.numorder####ENDIFordervalidation.numorder##&lt;br /&gt;##IFordervalidation.orderdate##&lt;strong&gt;##lang.ordervalidation.orderdate##&lt;/strong&gt;' . ' : ##ordervalidation.orderdate####ENDIFordervalidation.orderdate##&lt;br /&gt;' . '##IFordervalidation.state##&lt;strong&gt;##lang.ordervalidation.state##&lt;/strong&gt;' . ' : ##ordervalidation.state####ENDIFordervalidation.state##&lt;br /&gt;' . '##IFordervalidation.users##&lt;strong&gt;##lang.ordervalidation.users##&lt;/strong&gt;' . ' : ##ordervalidation.users####ENDIFordervalidation.users##&lt;br /&gt;&lt;br /&gt;' . '##IFordervalidation.comment##&lt;strong&gt;##lang.ordervalidation.comment##&lt;/strong&gt; : ##ordervalidation.comment####ENDIFordervalidation.comment##&lt;/p&gt;';
                $translation->add($tmp);
            }
            $notifs = array('New Order Validation' => 'ask', 'Confirm Order Validation' => 'validation', 'Cancel Order Validation' => 'undovalidation', 'Cancel Order' => 'cancel');
            $notification = new Notification();
            foreach ($notifs as $label => $name) {
                if (!countElementsInTable("glpi_notifications", "`itemtype`='PluginOrderOrder' AND `event`='{$name}'")) {
                    $tmp = array('name' => $label, 'entities_id' => 0, 'itemtype' => 'PluginOrderOrder', 'event' => $name, 'mode' => 'mail', 'comment' => '', 'is_recursive' => 1, 'is_active' => 1, 'date_mod' => $_SESSION['glpi_currenttime'], 'notificationtemplates_id' => $templates_id);
                    $notification->add($tmp);
                }
            }
        }
        $query_id = "SELECT `id`\n                       FROM `glpi_notificationtemplates`\n                       WHERE `itemtype`='PluginOrderOrder'\n                       AND `name` = 'Due date overtaken'";
        $result = $DB->query($query_id) or die($DB->error());
        if ($DB->numrows($result) > 0) {
            $templates_id = $DB->result($result, 0, 'id');
        } else {
            $tmp = array('name' => 'Due date overtaken', 'itemtype' => 'PluginOrderOrder', 'date_mod' => $_SESSION['glpi_currenttime'], 'comment' => '', 'css' => '');
            $templates_id = $template->add($tmp);
        }
        if ($templates_id) {
            $translation = new NotificationTemplateTranslation();
            if (!countElementsInTable($translation->getTable(), "`notificationtemplates_id`='{$templates_id}'")) {
                $tmp = array();
                $tmp['notificationtemplates_id'] = $templates_id;
                $tmp['language'] = '';
                $tmp['subject'] = '##order.action## ##order.entity##';
                $tmp['content_text'] = '##lang.order.entity## : ##order.entity##\\n' . ' \\n##FOREACHorders##\\n' . '##lang.order.item.name## : ##order.item.name##\\n ' . '##lang.order.item.numorder## : ##order.item.numorder##\\n ' . '##lang.order.item.orderdate## : ##order.item.orderdate##\\n ' . '##lang.order.item.duedate## : ##order.item.duedate##\\n ' . '##lang.order.item.deliverydate## : ##order.item.deliverydate##\\n ' . '##order.item.url## \\n ##ENDFOREACHorders##';
                $tmp['content_html'] = "##lang.order.entity## : ##order.entity##&lt;br /&gt; " . "&lt;br /&gt;##FOREACHorders##&lt;br /&gt;" . "##lang.order.item.name## : ##order.item.name##&lt;br /&gt; " . "##lang.order.item.numorder## : ##order.item.numorder##&lt;br /&gt; " . "##lang.order.item.orderdate## : ##order.item.orderdate##&lt;br /&gt; &lt;a&gt;" . "##lang.order.item.duedate## : ##order.item.duedate##&lt;br /&gt; &lt;/a&gt;&lt;a&gt;" . "##lang.order.item.deliverydate## : ##order.item.deliverydate##&lt;br /&gt; &lt;/a&gt;&lt;a&gt;" . "##order.item.url##&lt;/a&gt;&lt;br /&gt; ##ENDFOREACHorders##";
                $translation->add($tmp);
            }
            $notifs = array('Due date overtaken' => 'duedate');
            $notification = new Notification();
            foreach ($notifs as $label => $name) {
                if (!countElementsInTable("glpi_notifications", "`itemtype`='PluginOrderOrder' AND `event`='{$name}'")) {
                    $tmp = array('name' => $label, 'entities_id' => 0, 'itemtype' => 'PluginOrderOrder', 'event' => $name, 'mode' => 'mail', 'comment' => '', 'is_recursive' => 1, 'is_active' => 1, 'date_mod' => $_SESSION['glpi_currenttime'], 'notificationtemplates_id' => $templates_id);
                    $notification->add($tmp);
                }
            }
        }
        $template = new NotificationTemplate();
        $templates_id = false;
        $query_id = "SELECT `id`\n                       FROM `glpi_notificationtemplates`\n                       WHERE `itemtype`='PluginOrderOrder'\n                       AND `name` = 'Order Delivered'";
        $result = $DB->query($query_id) or die($DB->error());
        if ($DB->numrows($result) > 0) {
            $templates_id = $DB->result($result, 0, 'id');
        } else {
            $tmp = array('name' => 'Order Delivered', 'itemtype' => 'PluginOrderOrder', 'date_mod' => $_SESSION['glpi_currenttime'], 'comment' => '', 'css' => '');
            $templates_id = $template->add($tmp);
        }
        if ($templates_id) {
            $translation = new NotificationTemplateTranslation();
            if (!countElementsInTable($translation->getTable(), "`notificationtemplates_id`='{$templates_id}'")) {
                $tmp['notificationtemplates_id'] = $templates_id;
                $tmp['language'] = '';
                $tmp['subject'] = '##order.action## ##ordervalidation.name## ##ordervalidation.numorder##';
                $tmp['content_text'] = '##order.action##
##lang.ordervalidation.name## :
##ordervalidation.name##
##lang.ordervalidation.orderdate## :
##ordervalidation.orderdate##
##lang.ordervalidation.entity## :
##ordervalidation.entity##';
                $tmp['content_html'] = '&lt;p&gt;##order.action## &lt;br /&gt;&lt;br /&gt;&#160;
                ##lang.ordervalidation.name## : &lt;br /&gt;&#160;
                ##ordervalidation.name## &lt;br /&gt;&#160;
                ##lang.ordervalidation.orderdate## : &lt;br /&gt;&#160;
                ##ordervalidation.orderdate## &lt;br /&gt;&#160; &lt;br /&gt;&#160;
                ##lang.ordervalidation.entity## : &lt;br /&gt;&#160;##ordervalidation.entity##&lt;/p&gt;';
//.........这里部分代码省略.........
开发者ID:equinoxefr,项目名称:order,代码行数:101,代码来源:notificationtargetorder.class.php

示例13: processPostRequestUpdateVars

 /**
  *	Используется для сохранения настроек.
  *
  *	@author Anthony Boutinov
  *	
  *	@param array $short_names			CM$DICTIONARY.SHORT_NAME массив
  *	@retval bool						Возвращает статус: успешно или нет
  */
 public function processPostRequestUpdateVars($short_names)
 {
     function processFileToSQL($key, &$sql)
     {
         $user_file_key = $key . '_file';
         $fileName = $_FILES[$user_file_key]['name'];
         $tmpName = $_FILES[$user_file_key]['tmp_name'];
         $fileSize = $_FILES[$user_file_key]['size'];
         $fileType = $_FILES[$user_file_key]['type'];
         $fp = fopen($tmpName, 'r');
         $content = fread($fp, filesize($tmpName));
         $content = addslashes($content);
         fclose($fp);
         if (!get_magic_quotes_gpc()) {
             $fileName = addslashes($fileName);
         }
         $sql = $sql . 'BLOB_VALUE="' . $content . '"';
     }
     $rows = $this->getDataTypesForParentByShortName($short_names);
     // sanitized inside
     $post_is_fine = true;
     foreach ($rows as $key => $value) {
         if ($value['DATA_TYPE'] == 'file' || $value['DATA_TYPE'] == 'text&file') {
             if ($_FILES[$key . '_file']['size'] == 0) {
                 $rows[$key]['field_doesnt_need_an_update'] = true;
             }
         } else {
             if ($value['DATA_TYPE'] == 'checkbox') {
                 if (isset($_POST[$key])) {
                     $_POST[$key] = "T";
                 } else {
                     $_POST[$key] = "F";
                 }
             } else {
                 if (!isset($_POST[$key])) {
                     Notification::add("POST value for '{$key}' is not set.", 'danger');
                     $post_is_fine = false;
                 }
             }
         }
     }
     if (!$post_is_fine) {
         return false;
     }
     foreach ($rows as $key => $value) {
         if (isset($value['field_doesnt_need_an_update']) && $value['field_doesnt_need_an_update']) {
             continue;
         }
         $sql = 'update SP$VAR set ';
         if ($value['DATA_TYPE'] == 'file') {
             processFileToSQL($key, $sql);
         } else {
             if ($value['DATA_TYPE'] == 'text&file') {
                 processFileToSQL($key, $sql);
                 $sql = $sql . ', ';
             }
             $sql = $sql . 'VALUE="' . htmlspecialchars($_POST[$key]) . '"';
         }
         $sql = $sql . ' WHERE ID_DB_USER=' . $this->id_db_user . ' AND ID_DICTIONARY=' . $value['ID_DICTIONARY'];
         $this->getQueryResultWithErrorNoticing($sql);
     }
     Notification::add("Изменения сохранены!", 'success');
     return true;
 }
开发者ID:anthonyboutinov,项目名称:WiFiAuth,代码行数:72,代码来源:DBWiFiInterface.php

示例14: addNotification

/**
 * @param $text string
 * @param $type string Notification type
 * @param $list_id integer|null
 * @param $task_id integer|null
 */
function addNotification($text, $type, $list_id = null, $task_id = null)
{
    // only add Notifications if we are on multi user mode
    if (Config::get('multiuser') == 1) {
        try {
            Notification::add($text, $type, $list_id, $task_id);
        } catch (Exception $e) {
            var_dump($e->getMessage());
        }
    }
}
开发者ID:jmcclenon,项目名称:yourTinyTodo,代码行数:17,代码来源:ajax.php

示例15: Comment

    $content_comment = $_POST['my_comment'];
    $id_article = $_POST['id_article'];
    $author = $_SESSION['login'];
    $new_comment = new Comment($id_article, $author, $content_comment);
    $new_comment->add();
    $bdd = new PDO('mysql:host=localhost;dbname=bavn', 'root', '');
    $auteur_article = $bdd->query('SELECT id FROM members  WHERE id IN(SELECT id_author FROM articles WHERE id="' . $id_article . '")');
    $auteur_article = $auteur_article->fetch()[0];
    $commentateurs_article = $bdd->query('SELECT id, pseudo FROM members  WHERE pseudo IN(SELECT pseudo FROM comments WHERE id_article="' . $id_article . '")');
    $commentateurs_article = $commentateurs_article->fetchAll();
    $nombre_commentateurs = count($commentateurs_article);
    for ($i = 0; $i < $nombre_commentateurs + 1; $i++) {
        if ($i < $nombre_commentateurs) {
            $cur_id = $commentateurs_article[$i]['id'];
            $cur_pseudo = $commentateurs_article[$i]['pseudo'];
            if ($cur_pseudo != $author) {
                $new_not = new Notification($cur_id, $id_article, "Un nouveau commentaire sur une publication que vous suivez est apparu", '', 0);
            } else {
                $auteur_article = -1;
            }
        } else {
            if ($auteur_article != -1) {
                $new_not = new Notification($auteur_article, $id_article, "Un nouveau commentaire sur votre publication est apparu", '', 0);
            }
        }
        if (isset($new_not)) {
            $new_not->add();
        }
    }
    unset($new_comment);
}
开发者ID:bsamel,项目名称:bavn,代码行数:31,代码来源:post_comment.php


注:本文中的Notification::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。