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


PHP notifications类代码示例

本文整理汇总了PHP中notifications的典型用法代码示例。如果您正苦于以下问题:PHP notifications类的具体用法?PHP notifications怎么用?PHP notifications使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getSupportedHTML5Formats

 /**
  * Get supported HTML5 formats
  * @return array Return array of formats
  */
 public function getSupportedHTML5Formats()
 {
     $browser = $this->detectSupportedFormats();
     $formats = $this->getSupportedFormats();
     $html5 = array("oga", "mp3", "m4a", "wav");
     $final = array();
     $missing = array();
     $unsupported = array();
     foreach ($html5 as $i) {
         if (in_array($i, $browser) && in_array($i, $formats['out'])) {
             $final[] = $i;
         } elseif (in_array($i, $browser) && !in_array($i, $formats['out'])) {
             $missing[] = $i;
         } else {
             $unsupported[] = $i;
         }
     }
     $nt = notifications::create();
     $mmm = $this->getConfig('mediamissingmessage');
     if (!empty($missing) && empty($mmm)) {
         $brand = $this->FreePBX->Config->get("DASHBOARD_FREEPBX_BRAND");
         $nt->add_notice("framework", "missing_html5", _("Missing HTML5 format converters"), sprintf(_("You are missing support for the following HTML5 codecs: %s. To fully support HTML5 browser playback you will need to install programs that can not be distributed with %s. If you'd like to install the binaries needed for these conversions click 'Resolve' in the lower left corner of this message. You can also safely ignore this message but browser playback might not work in your browser."), implode(",", $missing), $brand), "http://wiki.freepbx.org/display/FOP/Installing+Media+Conversion+Libraries", true, true);
         $this->setConfig('mediamissingmessage', true);
     } elseif (empty($missing) && !empty($mmm)) {
         $nt->delete("framework", "missing_html5");
         $this->setConfig('mediamissingmessage', false);
     }
     return !empty($final[0]) ? array($final[0]) : array();
 }
开发者ID:lidl,项目名称:framework,代码行数:33,代码来源:Media.class.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArgument('args');
     $nt = \notifications::create();
     if ($input->getOption('list')) {
         $notifications = array();
         foreach ($nt->list_all() as $notif) {
             $notifications[] = array($notif['module'], $notif['id'], $notif['display_text']);
         }
         if ($input->getOption('json')) {
             $output->writeln(json_encode($notifications));
         } else {
             $table = new Table($output);
             $table->setHeaders(array('Module', 'ID', 'Text'))->setRows($notifications);
             $table->render();
         }
     }
     if ($input->getOption('delete')) {
         if (!isset($args[1])) {
             $output->writeln("Usage: fwconsole notifications --delete module id");
         }
         if ($nt->exists($args[0], $args[1])) {
             $output->writeln("Deleting notification");
             $nt->delete($args[0], $args[1]);
             if (!$nt->exists($args[0], $args[1])) {
                 $output->writeln("Notification Deleted");
             } else {
                 $output->writeln("Notification did not delete");
             }
         } else {
             $output->writeln("Specified notification does not exist");
         }
     }
 }
开发者ID:lidl,项目名称:framework,代码行数:34,代码来源:Notifications.class.php

示例3: set_language

function set_language()
{
    global $amp_conf, $db;
    $nt = notifications::create($db);
    if (extension_loaded('gettext')) {
        $nt->delete('core', 'GETTEXT');
        if (php_sapi_name() !== 'cli') {
            if (empty($_COOKIE['lang']) || !preg_match('/^[\\w\\._@-]+$/', $_COOKIE['lang'], $matches)) {
                $lang = $amp_conf['UIDEFAULTLANG'] ? $amp_conf['UIDEFAULTLANG'] : 'en_US';
                if (empty($_COOKIE['lang'])) {
                    setcookie("lang", $lang);
                }
            } else {
                preg_match('/^([\\w\\._@-]+)$/', $_COOKIE['lang'], $matches);
                $lang = !empty($matches[1]) ? $matches[1] : 'en_US';
            }
            $_COOKIE['lang'] = $lang;
        } else {
            $lang = $amp_conf['UIDEFAULTLANG'] ? $amp_conf['UIDEFAULTLANG'] : 'en_US';
        }
        putenv('LC_ALL=' . $lang);
        putenv('LANG=' . $lang);
        putenv('LANGUAGE=' . $lang);
        setlocale(LC_ALL, $lang);
        bindtextdomain('amp', $amp_conf['AMPWEBROOT'] . '/admin/i18n');
        bind_textdomain_codeset('amp', 'utf8');
        textdomain('amp');
        return $lang;
    }
    $nt->add_warning('core', 'GETTEXT', _("Gettext is not installed"), _("Please install gettext so that the PBX can properly translate itself"), 'https://www.gnu.org/software/gettext/');
    return 'en_US';
}
开发者ID:umjinsun12,项目名称:dngshin,代码行数:32,代码来源:view.functions.php

示例4: __construct

 function __construct($mode = 'local')
 {
     if ($mode == 'local') {
         //Setup our objects for use
         //FreePBX is the FreePBX Object
         $this->FreePBX = \FreePBX::create();
         //UCP is the UCP Specific Object from BMO
         $this->Ucp = $this->FreePBX->Ucp;
         //System Notifications Class
         //TODO: pull this from BMO
         $this->notifications = \notifications::create();
         //database subsystem
         $this->db = $this->FreePBX->Database;
         //This causes crazy errors later on. Dont use it
         //$this->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
     }
     $this->emoji = new Client(new Ruleset());
     $this->emoji->imagePathPNG = 'assets/images/emoji/png/';
     // defaults to jsdelivr's free CDN
     $this->emoji->imagePathSVG = 'assets/images/emoji/svg/';
     // defaults to jsdelivr's free CDN
     $this->detect = new \Mobile_Detect();
     // Ensure the local object is available
     self::$uobj = $this;
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:25,代码来源:UCP.class.php

示例5: weakpasswords_get_config

function weakpasswords_get_config($engine)
{
    switch ($engine) {
        case "asterisk":
            // Clear all weak password notifications
            $nt = notifications::create($db);
            $security_notifications = $nt->list_security();
            foreach ($security_notifications as $notification) {
                if ($notification['module'] == "weakpasswords") {
                    $nt->delete($notification['module'], $notification['id']);
                }
            }
            // Generate new notifications
            $weak = weakpasswords_get_users();
            if (sizeof($weak) > 0) {
                $extended_text = _("Warning: The use of weak SIP/IAX passwords can compromise this system resulting in toll theft of your telephony service.  You should change the reported devices and trunks to use strong secrets.") . "<br /><br />";
                $count = 0;
                foreach ($weak as $details) {
                    $extended_text .= sprintf(_("%s: %s / %s<br>"), $details['deviceortrunk'], $details['name'], $details['message']);
                    $count++;
                }
                if ($count == 1) {
                    $nt->add_security("weakpasswords", "all", $count . " " . _("extension/trunk has weak secret"), $extended_text);
                } else {
                    $nt->add_security("weakpasswords", "all", $count . " " . _("extensions/trunks have weak secrets"), $extended_text);
                }
            }
            break;
    }
}
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:30,代码来源:functions.inc.php

示例6: index

 function index()
 {
     if (isset($_GET['key'])) {
         $frontlinesms_key = $_GET['key'];
     }
     if (isset($_GET['s'])) {
         $message_from = $_GET['s'];
         // Remove non-numeric characters from string
         $message_from = ereg_replace("[^0-9]", "", $message_from);
     }
     if (isset($_GET['m'])) {
         $message_description = $_GET['m'];
     }
     if (!empty($frontlinesms_key) && !empty($message_from) && !empty($message_description)) {
         // Is this a valid FrontlineSMS Key?
         $keycheck = ORM::factory('settings', 1)->where('frontlinesms_key', $frontlinesms_key)->find();
         if ($keycheck->loaded == TRUE) {
             $services = new Service_Model();
             $service = $services->where('service_name', 'SMS')->find();
             if (!$service) {
                 return;
             }
             $reporter = ORM::factory('reporter')->where('service_id', $service->id)->where('service_account', $message_from)->find();
             if (!$reporter->loaded == TRUE) {
                 // get default reporter level (Untrusted)
                 $level = ORM::factory('level')->where('level_weight', 0)->find();
                 $reporter->service_id = $service->id;
                 $reporter->level_id = $level->id;
                 $reporter->service_userid = null;
                 $reporter->service_account = $message_from;
                 $reporter->reporter_first = null;
                 $reporter->reporter_last = null;
                 $reporter->reporter_email = null;
                 $reporter->reporter_phone = null;
                 $reporter->reporter_ip = null;
                 $reporter->reporter_date = date('Y-m-d');
                 $reporter->save();
             }
             // Save Message
             $message = new Message_Model();
             $message->parent_id = 0;
             $message->incident_id = 0;
             $message->user_id = 0;
             $message->reporter_id = $reporter->id;
             $message->message_from = $message_from;
             $message->message_to = null;
             $message->message = $message_description;
             $message->message_type = 1;
             // Inbox
             $message->message_date = date("Y-m-d H:i:s", time());
             $message->service_messageid = null;
             $message->save();
             // Notify Admin Of New Email Message
             $send = notifications::notify_admins("[" . Kohana::config('settings.site_name') . "] " . Kohana::lang('notifications.admin_new_sms.subject'), Kohana::lang('notifications.admin_new_sms.message'));
         }
     }
 }
开发者ID:subiet,项目名称:Swiftriver,代码行数:57,代码来源:frontlinesms.php

示例7: fatal

function fatal($text, $extended_text = "", $type = "FATAL")
{
    global $db;
    echo "[{$type}] " . $text . " " . $extended_text . "\n";
    if (!DB::isError($db)) {
        $nt = notifications::create($db);
        $nt->add_critical('cron_manager', $type, $text, $extended_text);
    }
    exit(1);
}
开发者ID:hardikk,项目名称:HNH,代码行数:10,代码来源:freepbx-cron-scheduler.php

示例8: installed

 public static function installed()
 {
     $loc = fpbx_which("sox");
     $process = new Process($loc . ' --version');
     $process->run();
     // executes after the command finishes
     $nt = \notifications::create();
     if (!$process->isSuccessful()) {
         $nt->add_warning("FRAMEWORK", "MISSING_SOX", _("System is missing SOX"), _("To perform the minimal amount of file conversions for HTML5 support and conversion support you need to at least install SOX"), "http://wiki.freepbx.org/display/FOP/Installing+Media+Conversion+Libraries");
         return false;
     } else {
         $nt->delete("FRAMEWORK", "MISSING_SOX");
     }
     return true;
 }
开发者ID:lidl,项目名称:framework,代码行数:15,代码来源:SoxShell.php

示例9: frameworkPasswordCheck

function frameworkPasswordCheck()
{
    global $amp_conf, $db;
    $nt = notifications::create($db);
    // Moved most of the other checks to retrieve_conf to avoid running every page load. These have been left
    // here becuase both of these settings could be affected differently in the php apache related settings vs.
    // what retrieve_conf would see running the CLI version of php
    //
    // send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not
    //
    if (get_magic_quotes_gpc()) {
        $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
    } else {
        $nt->delete('core', 'MQGPC');
    }
}
开发者ID:lidl,项目名称:framework,代码行数:16,代码来源:view.functions.php

示例10: __construct

 function __construct($mode = 'local')
 {
     if ($mode == 'local') {
         //Setup our objects for use
         //FreePBX is the FreePBX Object
         $this->FreePBX = \FreePBX::create();
         //UCP is the UCP Specific Object from BMO
         $this->Ucp = $this->FreePBX->Ucp;
         //System Notifications Class
         //TODO: pull this from BMO
         $this->notifications = \notifications::create();
         //database subsystem
         $this->db = $this->FreePBX->Database;
         //This causes crazy errors later on. Dont use it
         //$this->db->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
     }
     $this->detect = new \Mobile_Detect();
     // Ensure the local object is available
     self::$obj = $this;
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:20,代码来源:UCP.class.php

示例11: view


//.........这里部分代码省略.........
                     // No API Key!!
                     $comment_spam = 0;
                 }
                 $comment = new Comment_Model();
                 $comment->incident_id = 0;
                 if ($this->user) {
                     $comment->user_id = $this->user->id;
                     $comment->comment_author = $this->user->name;
                     $comment->comment_email = $this->user->email;
                 } else {
                     $comment->comment_author = strip_tags($post->comment_author);
                     $comment->comment_email = strip_tags($post->comment_email);
                 }
                 $comment->comment_description = strip_tags($post->comment_description);
                 $comment->comment_ip = $_SERVER['REMOTE_ADDR'];
                 $comment->comment_date = date("Y-m-d H:i:s", time());
                 // Activate comment for now
                 if ($comment_spam == 1) {
                     $comment->comment_spam = 1;
                     $comment->comment_active = 0;
                 } else {
                     $comment->comment_spam = 0;
                     $comment->comment_active = Kohana::config('settings.allow_comments') == 1 ? 1 : 0;
                 }
                 $comment->save();
                 // link comment to sharing_incident
                 $incident_comment = ORM::factory('sharing_incident_comment');
                 $incident_comment->comment_id = $comment->id;
                 $incident_comment->sharing_incident_id = $incident->id;
                 $incident_comment->save();
                 // Event::comment_add - Added a New Comment
                 Event::run('ushahidi_action.comment_add', $comment);
                 // Notify Admin Of New Comment
                 $send = notifications::notify_admins("[" . Kohana::config('settings.site_name') . "] " . Kohana::lang('notifications.admin_new_comment.subject'), Kohana::lang('notifications.admin_new_comment.message') . "\n\n'" . utf8::strtoupper($incident->incident_title) . "'" . "\n" . url::base() . 'reports/sharing/view/' . $id);
                 // Redirect
                 url::redirect('reports/sharing/view/' . $id);
             } else {
                 // No! We have validation errors, we need to show the form again, with the errors
                 // Repopulate the form fields
                 $form = arr::overwrite($form, $post->as_array());
                 // Populate the error fields, if any
                 $errors = arr::overwrite($errors, $post->errors('comments'));
                 $form_error = TRUE;
             }
         }
         // Filters
         $incident_title = $incident->incident_title;
         $incident_description = $incident->incident_description;
         Event::run('ushahidi_filter.report_title', $incident_title);
         Event::run('ushahidi_filter.report_description', $incident_description);
         $this->template->header->page_title .= $incident_title . Kohana::config('settings.title_delimiter');
         // Add Features
         // hardcode geometries to empty
         $this->template->content->features_count = 0;
         $this->template->content->features = array();
         $this->template->content->incident_id = $incident->id;
         $this->template->content->incident_title = $incident_title;
         $this->template->content->incident_description = $incident_description;
         $this->template->content->incident_location = $incident->location->location_name;
         $this->template->content->incident_latitude = $incident->location->latitude;
         $this->template->content->incident_longitude = $incident->location->longitude;
         $this->template->content->incident_date = date('M j Y', strtotime($incident->incident_date));
         $this->template->content->incident_time = date('H:i', strtotime($incident->incident_date));
         $this->template->content->incident_category = ORM::factory('sharing_incident_category')->where('sharing_incident_id', $incident->id)->find_all();
         // Incident rating
         $rating = ORM::factory('rating')->join('incident', 'incident.id', 'rating.incident_id', 'INNER')->where('rating.incident_id', $incident->id)->find();
开发者ID:rjmackay,项目名称:Ushahidi-plugin-sharing_two,代码行数:67,代码来源:sharing.php

示例12: writeConfig

 /**
  * Hook Definitions
  * @param {string} $conf The Configuration being passed through
  */
 public function writeConfig($conf)
 {
     //we also need to do port checking and if in chan sip mode port on 5060, if in both mode then put if on 5061
     $nt = \notifications::create();
     $ast_sip_driver = $this->freepbx->Config->get_conf_setting('ASTSIPDRIVER');
     if (version_compare($this->version, '12', 'ge')) {
         if ($ast_sip_driver == 'both') {
             $this->freepbx->ModulesConf->removenoload("chan_sip.so");
             foreach ($this->PJSipModules as $mod) {
                 $this->freepbx->ModulesConf->removenoload($mod);
             }
         } elseif ($ast_sip_driver == 'chan_pjsip') {
             $this->enablePJSipModules();
         } elseif ($ast_sip_driver == 'chan_sip') {
             $this->disablePJSipModules();
         }
     } else {
         // We don't support pjsip. If we're trying to use it, don't. Note
         // that if there are devices or trunks trying to use chan_pjsip, we
         // complain loudly about it core_devices_configpageload
         if ($ast_sip_driver == 'chan_pjsip' || $ast_sip_driver == 'both') {
             $this->freepbx->Config->set_conf_values(array('ASTSIPDRIVER' => 'chan_sip'), true, true);
         }
     }
     $this->freepbx->WriteConfig($conf);
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:30,代码来源:PJSip.class.php

示例13: view

 /**
  * Displays a report.
  * @param boolean $id If id is supplied, a report with that id will be
  * retrieved.
  */
 public function view($id = false)
 {
     $this->template->header->this_page = 'reports';
     $this->template->content = new View('reports_view');
     // Load Akismet API Key (Spam Blocker)
     $api_akismet = Kohana::config('settings.api_akismet');
     if (!$id) {
         url::redirect('main');
     } else {
         $incident = ORM::factory('incident', $id);
         if ($incident->id == 0) {
             url::redirect('main');
         }
         // Comment Post?
         // Setup and initialize form field names
         $form = array('comment_author' => '', 'comment_description' => '', 'comment_email' => '', 'comment_ip' => '', 'captcha' => '');
         $captcha = Captcha::factory();
         $errors = $form;
         $form_error = FALSE;
         // Check, has the form been submitted, if so, setup validation
         if ($_POST) {
             // Instantiate Validation, use $post, so we don't overwrite $_POST fields with our own things
             $post = Validation::factory($_POST);
             // Add some filters
             $post->pre_filter('trim', TRUE);
             // Add some rules, the input field, followed by a list of checks, carried out in order
             $post->add_rules('comment_author', 'required', 'length[3,100]');
             $post->add_rules('comment_description', 'required');
             $post->add_rules('comment_email', 'required', 'email', 'length[4,100]');
             $post->add_rules('captcha', 'required', 'Captcha::valid');
             // Test to see if things passed the rule checks
             if ($post->validate()) {
                 // Yes! everything is valid
                 if ($api_akismet != "") {
                     // Run Akismet Spam Checker
                     $akismet = new Akismet();
                     // comment data
                     $comment = array('author' => $post->comment_author, 'email' => $post->comment_email, 'website' => "", 'body' => $post->comment_description, 'user_ip' => $_SERVER['REMOTE_ADDR']);
                     $config = array('blog_url' => url::site(), 'api_key' => $api_akismet, 'comment' => $comment);
                     $akismet->init($config);
                     if ($akismet->errors_exist()) {
                         if ($akismet->is_error('AKISMET_INVALID_KEY')) {
                             // throw new Kohana_Exception('akismet.api_key');
                         } elseif ($akismet->is_error('AKISMET_RESPONSE_FAILED')) {
                             // throw new Kohana_Exception('akismet.server_failed');
                         } elseif ($akismet->is_error('AKISMET_SERVER_NOT_FOUND')) {
                             // throw new Kohana_Exception('akismet.server_not_found');
                         }
                         // If the server is down, we have to post
                         // the comment :(
                         // $this->_post_comment($comment);
                         $comment_spam = 0;
                     } else {
                         if ($akismet->is_spam()) {
                             $comment_spam = 1;
                         } else {
                             $comment_spam = 0;
                         }
                     }
                 } else {
                     // No API Key!!
                     $comment_spam = 0;
                 }
                 $comment = new Comment_Model();
                 $comment->incident_id = $id;
                 $comment->comment_author = strip_tags($post->comment_author);
                 $comment->comment_description = strip_tags($post->comment_description);
                 $comment->comment_email = strip_tags($post->comment_email);
                 $comment->comment_ip = $_SERVER['REMOTE_ADDR'];
                 $comment->comment_date = date("Y-m-d H:i:s", time());
                 // Activate comment for now
                 if ($comment_spam == 1) {
                     $comment->comment_spam = 1;
                     $comment->comment_active = 0;
                 } else {
                     $comment->comment_spam = 0;
                     $comment->comment_active = 1;
                 }
                 $comment->save();
                 // Notify Admin Of New Comment
                 $send = notifications::notify_admins("[" . Kohana::config('settings.site_name') . "] " . Kohana::lang('notifications.admin_new_comment.subject'), Kohana::lang('notifications.admin_new_comment.message') . "\n\n'" . strtoupper($incident->incident_title) . "'" . "\n" . url::base() . 'reports/view/' . $id);
                 // Redirect
                 url::redirect('reports/view/' . $id);
             } else {
                 // repopulate the form fields
                 $form = arr::overwrite($form, $post->as_array());
                 // populate the error fields, if any
                 $errors = arr::overwrite($errors, $post->errors('comments'));
                 $form_error = TRUE;
             }
         }
         $this->template->content->incident_id = $incident->id;
         $this->template->content->incident_title = $incident->incident_title;
         $this->template->content->incident_description = nl2br($incident->incident_description);
         $this->template->content->incident_location = $incident->location->location_name;
//.........这里部分代码省略.........
开发者ID:kiirti,项目名称:Ushahidi_MHI,代码行数:101,代码来源:reports.php

示例14: createIntermediaries

 private function createIntermediaries()
 {
     //generate intermediary file
     $ts = time() . rand(0, 1000);
     $soxClass = "Media\\Driver\\Drivers\\SoxShell";
     if (!$soxClass::installed()) {
         throw new \Exception("Sox needs to be installed");
     }
     //Convert everything to 48k, so we upscale and downscale
     //This is on purpose.
     //Transform into a wav file
     foreach ($this->getDrivers() as $driver) {
         if ($this->extension == "wav" && $driver == "AsteriskShell") {
             continue;
             //just dont allow it
         }
         $class = "Media\\Driver\\Drivers\\" . $driver;
         if ($class::installed() && $class::isCodecSupported($this->extension, "in")) {
             $d = new $class($this->track, $this->extension, $this->mime, 48000, 1, 16);
             $d->convert($this->tempDir . "/temp." . $ts . ".wav", "wav", "audio/x-wav");
             $intermediary['wav']['path'] = $this->tempDir . "/temp." . $ts . ".wav";
             $intermediary['wav']['extension'] = "wav";
             $intermediary['wav']['mime'] = "audio/x-wav";
             break;
         }
     }
     if (!isset($intermediary['wav']['path']) || !file_exists($intermediary['wav']['path'])) {
         throw new \Exception(sprintf(_("Unable to find an intermediary converter for %s"), $this->track));
     }
     //Asterisk 11 should support sln48 but it doesnt, it says it does but then complains
     //It might be a bug, regardless this is fixed in 13 people should just use it
     $ver = \FreePBX::Config()->get("ASTVERSION");
     if (version_compare_freepbx($ver, "13.0", "ge") && \Media\Driver\Drivers\AsteriskShell::isCodecSupported("sln48", "in")) {
         $type = "sln48";
         $samplerate = 48000;
     } elseif (\Media\Driver\Drivers\AsteriskShell::isCodecSupported("sln16", "in")) {
         $type = "sln16";
         $samplerate = 16000;
     } else {
         $type = "wav16";
         $samplerate = 16000;
     }
     $nt = \notifications::create();
     if (version_compare_freepbx($ver, "13.0", "ge") && !\Media\Driver\Drivers\AsteriskShell::isCodecSupported("sln48", "in")) {
         //something is wacky here
         $nt->add_warning("FRAMEWORK", "UNSUPPORTED_SLN48", _("The file format sln48 is not supported on your system"), _("The file format sln48 is not supported by Asterisk when it should be. Audio conversion quality will be limited to 16k instead of 48k"));
     } else {
         $nt->delete("FRAMEWORK", "UNSUPPORTED_SLN48");
     }
     //Now transform into a raw audio file
     $d = new $soxClass($intermediary['wav']['path'], $intermediary['wav']['extension'], $intermediary['wav']['mime'], $samplerate, 1, 16);
     $d->convert($this->tempDir . "/temp." . $ts . "." . $type, $type, "audio/x-raw");
     $intermediary['sln']['path'] = $this->tempDir . "/temp." . $ts . "." . $type;
     $intermediary['sln']['extension'] = $type;
     $intermediary['sln']['mime'] = "audio/x-raw";
     if (empty($intermediary)) {
         throw new \Exception("No Driver found for " . $this->extension);
     }
     if (!file_exists($intermediary['wav']['path']) || !file_exists($intermediary['sln']['path'])) {
         throw new \Exception("Intermediary files could not be created");
     }
     return $intermediary;
 }
开发者ID:powerpbx,项目名称:framework,代码行数:63,代码来源:Media.php

示例15: getAllSignatures

 /**
  * Get all Cached Signatures, update if it doesnt exist
  * @param {bool} $cached=true Whether to use cached data or not
  */
 function getAllSignatures($cached = true, $online = false)
 {
     FreePBX::GPG();
     //declare class to get constants
     $sql = "SELECT modulename, signature FROM modules";
     $sth = FreePBX::Database()->prepare($sql);
     $sth->execute();
     $res = $sth->fetchAll(PDO::FETCH_ASSOC);
     $modules = array();
     $globalValidation = true;
     // String below, if i18n'ed, must be identical to that in GPG class.
     // Read the comment there.
     $amportal = FreePBX::Config()->get('AMPSBIN') . "/amportal " . _("altered");
     if (!$cached && $online) {
         FreePBX::GPG()->refreshKeys();
     }
     foreach ($res as $mod) {
         // Ignore ARI for the moment.
         if ($mod['modulename'] == 'fw_ari') {
             continue;
         }
         //TODO: determine if this should be in here or not.
         if (!$cached || empty($mod['signature'])) {
             $mod['signature'] = $this->updateSignature($mod['modulename']);
         } else {
             $mod['signature'] = json_decode($mod['signature'], TRUE);
         }
         $modules['modules'][$mod['modulename']] = $mod;
         if (!is_int($mod['signature']['status'])) {
             $modules['statuses']['unsigned'][] = sprintf(_('Module "%s" is is missing its signature status.'), $modname);
             continue;
         }
         if (~$mod['signature']['status'] & GPG::STATE_GOOD) {
             $globalValidation = false;
         }
         $trusted = $mod['signature']['status'] & GPG::STATE_TRUSTED;
         $tampered = $mod['signature']['status'] & GPG::STATE_TAMPERED;
         $unsigned = $mod['signature']['status'] & GPG::STATE_UNSIGNED;
         $invalid = $mod['signature']['status'] & GPG::STATE_INVALID;
         $revoked = $mod['signature']['status'] & GPG::STATE_REVOKED;
         //if revoked then disable
         $md = $this->getInfo();
         $modname = !empty($md[$mod['modulename']]['name']) ? $md[$mod['modulename']]['name'] : sprintf(_('%s [not enabled]'), $mod['modulename']);
         if ($invalid) {
             $modules['statuses']['tampered'][] = sprintf(_('Module "%s" signed by an invalid key.'), $modname);
         }
         if ($unsigned) {
             if ($mod['modulename'] == "framework" || $mod['modulename'] == "core") {
                 // Unsigned framework or core is extremely terribly bad.
                 $modules['statuses']['tampered'][] = sprintf(_('Critical Module "%s" is unsigned, re-download immediately'), $modname);
             } else {
                 $modules['statuses']['unsigned'][] = sprintf(_('Module "%s" is unsigned and should be re-downloaded'), $modname);
             }
         } else {
             if ($tampered) {
                 foreach ($mod['signature']['details'] as $d) {
                     if ($d == $amportal) {
                         $modules['statuses']['tampered'][] = sprintf(_("Module: '%s', File: '%s' (If you just updated FreePBX, you'll need to run 'amportal chown' and then 'amportal a r' to clear this message. If you did not just update FreePBX, your system may have been compromised)"), $modname, $d);
                     } else {
                         $modules['statuses']['tampered'][] = sprintf(_('Module: "%s", File: "%s"'), $modname, $d);
                     }
                 }
             }
             if (!$trusted) {
                 if ($revoked) {
                     $modules['statuses']['revoked'][] = sprintf(_('Module: "%s"\'s signature has been revoked. Module has been automatically disabled'), $modname);
                 }
             }
         }
     }
     $statuses = array('untrusted' => _('untrusted'), 'unsigned' => _('unsigned'), 'tampered' => _('tampered'), 'unknown' => _('unknown'), 'revoked' => _('revoked'));
     $nt = notifications::create();
     foreach ($statuses as $type => $name) {
         if (!empty($modules['statuses'][$type]) && FreePBX::Config()->get('SIGNATURECHECK')) {
             switch ($type) {
                 case 'unsigned':
                     //TODO: check the hash
                     $hash = md5(json_encode($modules['statuses'][$type]));
                     $sth = FreePBX::Database()->prepare("SELECT value FROM admin WHERE variable = 'unsigned' LIMIT 1");
                     $sth->execute();
                     $o = $sth->fetch();
                     if (empty($o)) {
                         $nt->add_signature_unsigned('freepbx', 'FW_' . strtoupper($type), sprintf(_('You have %s unsigned modules'), count($modules['statuses'][$type])), implode("<br>", $modules['statuses'][$type]), '', true, true);
                         sql("INSERT INTO admin (variable, value) VALUE ('unsigned', '{$hash}')");
                     } elseif ($o['value'] != $hash) {
                         $nt->add_signature_unsigned('freepbx', 'FW_' . strtoupper($type), sprintf(_('You have %s unsigned modules'), count($modules['statuses'][$type])), implode("<br>", $modules['statuses'][$type]), '', true, true);
                         $sth = FreePBX::Database()->prepare("UPDATE admin SET value = ? WHERE variable = 'unsigned'");
                         $sth->execute(array($hash));
                     }
                     break;
                 case 'tampered':
                     $nt->add_security('freepbx', 'FW_' . strtoupper($type), sprintf(_('You have %s tampered files'), count($modules['statuses'][$type])), implode("<br>", $modules['statuses'][$type]));
                     break;
                 default:
                     $nt->add_security('freepbx', 'FW_' . strtoupper($type), sprintf(_('You have %s %s modules'), count($modules['statuses'][$type]), $name), implode("<br>", $modules['statuses'][$type]));
                     break;
//.........这里部分代码省略.........
开发者ID:ntadmin,项目名称:framework,代码行数:101,代码来源:modulefunctions.class.php


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