Exemplo n.º 1
0
 /**
  * Sets a name of the target of this migration
  */
 protected function setTargetName($name)
 {
     if ($name && $name !== 'OpenPNE') {
         $this->targetName = $name;
         $this->pluginInstance = opPlugin::getInstance($this->targetName, $this->dispatcher);
     } else {
         $this->targetName = 'OpenPNE';
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     $configuration = $this->createConfiguration('pc_frontend', 'cli');
     $name = $arguments['name'];
     if (!$configuration->isPluginExists($name)) {
         throw new sfException(sprintf('Plugin "%s" does not installed', $name));
     }
     if ($configuration->isDisabledPlugin($name)) {
         throw new sfException(sprintf('Plugin "%s" is already disactivated', $name));
     }
     opPlugin::getInstance($name)->setIsActive(false);
     $cc = new sfCacheClearTask($this->dispatcher, $this->formatter);
     $cc->run();
 }
 protected function execute($arguments = array(), $options = array())
 {
     $this->log($this->formatter->format('Core versions:', 'COMMENT'));
     $this->displayLine('OpenPNE', OPENPNE_VERSION);
     $this->displayLine('symfony', SYMFONY_VERSION);
     $this->log($this->formatter->format('OpenPNE plugin versions:', 'COMMENT'));
     foreach ($this->configuration->getAllOpenPNEPlugins() as $name) {
         $version = opPlugin::getInstance($name, $this->dispatcher)->getVersion();
         if (!$version) {
             $version = 'unknown';
         }
         $this->displayLine($name, $version);
     }
 }
 public function doRun()
 {
     opPlugin::getInstance('opSkinBasicPlugin', $this->options['dispatcher'])->setIsActive(false);
     opPlugin::getInstance('opSkinClassicPlugin', $this->options['dispatcher'])->setIsActive(true);
     $colorTable = array('line_color' => 'color_5', 'page_background_color' => 'color_16', 'contents_background_color' => 'color_17', 'frame_color' => 'color_4', 'header_background_color' => 'color_10', 'information_background_color' => 'color_13', 'box_background_color' => 'color_6', 'left_menu_background_color' => 'color_14');
     foreach ($colorTable as $key => $value) {
         $this->conn->execute('INSERT INTO skin_config (plugin, name, value, created_at, updated_at) (SELECT "opSkinClassicPlugin", "' . $key . '", ' . $value . ', NOW(), NOW() FROM c_config_color WHERE c_config_color_id = ?)', array(1));
     }
     $this->conn->execute('INSERT INTO skin_config (plugin, name, value, created_at, updated_at) (SELECT "opSkinClassicPlugin", "theme", value, NOW(), NOW() FROM c_admin_config WHERE name = "OPENPNE_SKIN_THEME")');
     $images = array('skin_after_header', 'skin_after_header_2', 'skin_before_header', 'skin_footer', 'skin_login', 'skin_login_open', 'skin_before_header_2', 'skin_navi_c', 'skin_navi_c_2', 'skin_navi_f', 'skin_navi_f_2', 'skin_navi_h', 'skin_navi_h_2', 'icon_arrow_1', 'bg_button', 'content_header_1', 'icon_title_1', 'icon_arrow_2', 'colon', 'icon_information', 'marker', 'articleList_marker', 'icon_3', 'icon_1', 'icon_2');
     foreach ($images as $image) {
         $this->conn->execute('INSERT INTO skin_config (plugin, name, value, created_at, updated_at) (SELECT "opSkinClassicPlugin", "' . $image . '_image", filename, NOW(), NOW() FROM c_skin_filename WHERE skinname = ?)', array($image));
     }
     $this->conn->execute('DROP TABLE c_config_color');
 }
 public function send()
 {
     $pluginMember = Doctrine::getTable('PluginMember')->create(array('member_id' => sfContext::getInstance()->getUser()->getMemberId(), 'position' => 'developer'));
     $this->package->PluginMember[] = $pluginMember;
     $this->package->save();
     if (opPlugin::getInstance('opMessagePlugin')->getIsActive()) {
         // temporary disable for opMessagePlugin bug
         /*
          $sender = new opMessageSender();
          $sender->setToMember(Doctrine::getTable('Member')->find(1))
            ->setSubject(sfContext::getInstance()->getI18N()->__('Join request to plugin developer team'))
            ->setBody($this->getValue('message'))
            ->setMessageType('plugin_join')
            ->setIdentifier($pluginMember->id)
            ->send();
         */
     }
 }
 /**
  * Executes show action
  *
  * @param sfWebRequest $request A request object
  */
  public function executeShow(sfWebRequest $request)
  {
    $this->isAshiatoUsable = opPlugin::getInstance('opAshiatoPlugin')->getIsActive();
    $this->isTopicUsable = opPlugin::getInstance('opCommunityTopicPlugin')->getIsActive();

    if (!$request->hasParameter('type'))
    {
      if ($this->isAshiatoUsable)
      {
        $this->type = 'access';
      }
      elseif (opConfig::get('enable_friend_link', true))
      {
        $this->type = 'friend';
      }
      else
      {
        $this->type = 'community';
      }
    }
    else
    {
      $this->type = $request->getParameter('type');
    }

    switch ($this->type)
    {
      case "access" :
        $this->forward404Unless($this->isAshiatoUsable);
        break;
      case "friend" :
        $this->forward404Unless(opConfig::get('enable_friend_link', true));
        break;
      case "topic" :
        $this->forward404Unless($this->isTopicUsable);
    }
  }
 public function executeJoin(sfWebRequest $request)
 {
     $this->form = new opPluginPackageJoinForm();
     $this->form->setPluginPackage($this->package);
     if (opPlugin::getInstance('opMessagePlugin')->getIsActive()) {
         $this->form->injectMessageField();
     }
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->form->bind($request['plugin_join']);
         if ($this->form->isValid()) {
             $this->form->send();
             $this->getUser()->setFlash('notice', 'Sent join request');
             $this->redirect('package_home', $this->package);
         }
     }
 }
 public function getPluginInstance($plugin)
 {
     return opPlugin::getInstance($plugin);
 }